<template>
  <el-dialog
    title="新增商品"
    class="main_dialog dialog1000"
    :visible.sync="dialogVisible"
  >
    <div class="mainor">
      <el-form
        :inline="true"
        :rules="rules"
        :model="monitorForm"
        class="demo-form-inline"
        ref="userListFrom"
        label-width="80px"
      >
        <!-- 商品名称 -->
        <div
          class="main_spac1"
          style="padding-top: 5px"
          @click="(mainor_ex = false), (mainor_co = false)"
        >
          <div class="main_white padding10">
            <div class="mainor_sp boxdq" style="">
              <div class="top-box">
                <ul class="box">
                  <li class="box">
                    <span> <em>*</em>商品名称： </span>
                    <el-autocomplete
                      v-model="formsp.value"
                      ref="searchSelect"
                      class="wid240 main_comm"
                      @clear="$refs.searchSelect.$children[0].blur()"
                      :fetch-suggestions="
                        (queryString, cb) => {
                          querySearchAsync(queryString, cb);
                        }
                      "
                      placeholder="商品/助记码/编码"
                      clearable
                      :highlight-first-item="true"
                      value-key="name"
                      @select="
                        (item) => {
                          handleSelect(item);
                        }
                      "
                    >
                      <template slot-scope="{ item }">
                        <div class="main_name">
                          <span>
                            {{ item.goods.name }}【{{
                              item.spu_name ? item.spu_name.title : ""
                            }}】
                          </span>
                          <span
                            class="main_addr"
                            v-if="info.show_sku_code == 1"
                            >{{ item.goods_spu_code }}</span
                          >
                        </div>
                      </template>
                    </el-autocomplete>
                  </li>
                  <li class="box">
                    <span> <em>*</em>数量： </span>
                    <el-input
                      v-model.trim="formsp.num"
                      ref="focusw2"
                      placeholder="数量"
                      clearable
                      class="wid140"
                      @keyup.enter.native="mainor_sp"
                    ></el-input>
                  </li>
                </ul>
                <div class="marginBottom10">
                  <el-button
                    type="primary"
                    :disabled="mainor_qr_disabled"
                    @click="mainor_qr"
                    >确认(回车)</el-button
                  >
                  <el-button
                    class="reset marginLeft5"
                    type="info"
                    @click="reset"
                    >重置</el-button
                  >
                </div>
                <div class="svg_box marginBottom10">
                  <svg
                    aria-hidden="true"
                    :class="[
                      sort_order_down ? 'new_navbar_svg' : 'new_navbar_svg2',
                    ]"
                    width="28"
                    height="28"
                    @click="handleSort"
                  >
                    <use xlink:href="#icon-order_sort_btn" />
                  </svg>
                  <el-tooltip class="item" effect="dark" placement="bottom">
                    <div slot="content">
                      箭头向上，新增的商品在最下面；
                      <br />
                      箭头向下，新增的商品在最上面
                    </div>
                    <svg
                      aria-hidden="true"
                      class="navbar_svg"
                      width="16"
                      height="16"
                    >
                      <use xlink:href="#icon-summary_question" />
                    </svg>
                  </el-tooltip>
                </div>
              </div>
              <!-- <div class="btn-all">
              <el-button @click.stop="smart(1)" class="mainor_copy lf-m-l10"
                >智能识别</el-button
              >
              <el-button @click.stop="mainor_copy" class="mainor_copy"
                >复制订单</el-button
              >
            </div> -->
            </div>
            <div
              class="main_table main_taf marginTop0"
              style="min-height: 330px"
            >
              <el-table
                ref="multipleTable"
                :data="monitorForm.list"
                element-loading-text="加载中"
                fit
                border
                highlight-current-row
              >
                <el-table-column label="序号" width="80">
                  <template slot-scope="scope">{{
                    scope.row.list_index
                  }}</template>
                </el-table-column>
                <!-- <div v-for="(field, index) in info.field" :key="index"> -->
                <el-table-column
                  label="商品图片"
                  prop="url"
                  width="100"
                  class-name="main_hei"
                  v-if="info.field.indexOf(2) != -1"
                >
                  <template slot-scope="scope">
                    <div class="demo-image__error mainor_im">
                      <el-image fit="fill" :src="scope.row.url">
                        <div slot="error" class="image-slot">
                          <img :src="puzzleImg" />
                        </div>
                      </el-image>
                    </div>
                  </template>
                </el-table-column>
                <el-table-column
                  label="商品名称"
                  prop="name"
                  width="100"
                  :show-overflow-tooltip="true"
                  v-if="info.field.indexOf(3) != -1"
                >
                  <template slot-scope="scope">
                    {{ scope.row.name }}【{{ scope.row.spu_name }}】
                  </template>
                </el-table-column>
                <el-table-column
                  label="描述"
                  prop="describe"
                  v-if="info.field.indexOf(4) != -1"
                  :show-overflow-tooltip="true"
                />
                <el-table-column
                  label="单位"
                  prop="unit"
                  v-if="info.field.indexOf(5) != -1"
                  :show-overflow-tooltip="true"
                />
                <el-table-column
                  label="现有库存"
                  prop="name"
                  width="100"
                  v-if="info.field.indexOf(6) != -1"
                  :show-overflow-tooltip="true"
                >
                  <template slot-scope="scope">
                    {{ scope.row.num }}
                  </template>
                </el-table-column>
                <el-table-column
                  label="起订量"
                  prop="minimum"
                  v-if="info.field.indexOf(7) != -1"
                  :show-overflow-tooltip="true"
                >
                </el-table-column>
                <el-table-column
                  label="指定库存"
                  width="100"
                  prop="designated_inventory"
                  v-if="info.field.indexOf(8) != -1"
                  :show-overflow-tooltip="true"
                >
                </el-table-column>
                <el-table-column
                  label="数量"
                  class-name="main_hei"
                  v-if="info.field.indexOf(9) != -1"
                  min-width="160"
                >
                  <template slot-scope="scope">
                    <el-form-item
                      :prop="'list.' + scope.$index + '.order_num'"
                      :rules="rules.order_num"
                      label-width="10px"
                      label=" "
                    >
                      <el-input
                        v-model.trim="scope.row.order_num"
                        :ref="'order_num' + scope.row.goods_spu_id"
                        placeholder="数量"
                        class="wid110"
                      ></el-input>
                    </el-form-item>
                  </template>
                </el-table-column>
                <el-table-column
                  label="采购价"
                  prop="purchase_price"
                  v-if="info.field.indexOf(1) != -10"
                >
                  <template slot-scope="scope">
                    <span :style="{ color: scope.row.red ? 'red' : '' }">
                      {{ scope.row.purchase_price }}
                    </span>
                  </template>
                </el-table-column>
                <el-table-column
                  label="单价"
                  prop="order_price"
                  class-name="main_hei"
                  v-if="info.field.indexOf(1) != -11"
                  min-width="180"
                >
                  <template slot-scope="scope">
                    <el-form-item
                      :prop="'list.' + scope.$index + '.order_price'"
                      :rules="rules.order_price"
                      label-width="10px"
                      label=" "
                    >
                      <el-input
                        v-model.trim="scope.row.order_price"
                        :ref="'order_price' + scope.row.goods_spu_id"
                        placeholder="单价"
                        class="wid110"
                      ></el-input>
                      <el-popover
                        placement="bottom"
                        width="180"
                        trigger="hover"
                      >
                        <div class="order_num_tips">
                          <span>上一次单价：{{ scope.row.pre_price }}</span>
                          <span
                            >上一次采购价：{{
                              scope.row.pre_purchase_price
                            }}</span
                          >
                        </div>
                        <i
                          slot="reference"
                          style="font-size: 16px"
                          class="el-icon-question"
                        ></i>
                      </el-popover>
                    </el-form-item>
                  </template>
                </el-table-column>
                <el-table-column
                  label="小计"
                  prop="userNickname"
                  v-if="info.field.indexOf(1) != -12"
                >
                  <template slot-scope="scope">{{
                    $toFixed(scope.row.order_num * scope.row.order_price)
                  }}</template>
                </el-table-column>
                <!-- </div> -->
                <el-table-column
                  label="备注"
                  prop="remark"
                  width="350"
                  class-name="main_hei"
                >
                  <template slot-scope="scope">
                    <el-input
                      v-model.trim="scope.row.remark"
                      placeholder="备注"
                      class="wid240"
                    ></el-input>
                    <el-link type="danger" @click="scdelete(scope.$index)"
                      >删除</el-link
                    >
                  </template>
                </el-table-column>
              </el-table>
            </div>

            <div class="paddingBottom10" id="newConBox">
              <div class="newConBox_h32">
                <div
                  :class="[
                    'mainor_pr boxdq newConBox ',
                    { on: searchBarFixed },
                  ]"
                >
                  <div class="mainor_prl">
                    <el-button
                      :loading="loading"
                      type="primary"
                      @click="preservation(2), (beforeNext = false)"
                      v-repeatClick
                      >保存</el-button
                    >
                    <!-- <el-button
                    class="marginLeft10"
                    type="info"
                    @click="preservation(1)"
                    v-repeatClick
                    >保存并继续添加</el-button
                  > -->

                    <el-button @click="$router.back(-1)">取消</el-button>
                  </div>
                  <div class="mainor_prr">
                    合计品种：{{ monitorForm.list.length }}件
                    <span>合计金额：¥{{ total }}</span>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </el-form>
    </div>
  </el-dialog>
</template>

<script>
const shuju = {
  list: {
    list_index: "",
    pre_purchase_price: "",
    pre_price: "",
    // 新增
    pid: "",
    category_id: "",
    pic: "",
    url: "",
    name: "",
    describe: "",
    goods_id: "",
    standard_goods_id: "",
    goods_spu_id: "",
    standard_spu_id: "",
    standard_spu_code: "",
    byname: "",
    spu_name: "",
    unit: "",
    order_num: "",
    order_price: "",
    purchase_price: "",
    remark: "",
    cycle_id: "",
    show: false,
    discount: "",
  },
  form: {
    name_uid: "",
    uid: "",
    nickname: "",
    line_id: "",
    salesman_id: "",
    contact: "",
    mobile: "",
    address: "",
    send_time: "",
    send_time_id: 0,
    auto_merge_order: false,
    auto_split_order: false,
    remark: "",
    zid: null,
    sub_zid: null,
  },
  formsp: {
    name: [],
    girard: null,
    num: "",
    value: "",
  },
  address: {
    address: {
      name: "",
      mobile: "",
      address: "",
      detail: "",
    },
    info: {},
    subAccount: [],
  },
};

import { mapGetters } from "vuex";
import {
  order_base,
  order_getMemberInfo,
  order_copyList,
  order_add,
  goods_getOfferPrice,
  member_getMembers,
  order_getOrderList,
  vague_search,
  text_identify,
  upload_images,
  identity_export_template,
} from "@/api/order/orderList";
import { apiUrl, objKeySort, Md5 } from "@/utils/public";
import rules from "@/rules/order/orderList_add";
import {
  puzzleImg,
  field_save,
  setting_company,
  goods_getAllGoodsSpu,
} from "@/api/currency";
import { orderAddHeader } from "@/options/headerSet.js";
import { parseTime, exportMethod } from "@/utils/index";

function compare(property) {
  return function (a, b) {
    let value1 = a[property];
    let value2 = b[property];
    return value1 - value2;
  };
}

export default {
  computed: {
    ...mapGetters(["avatar", "token"]),
    total() {
      let sz = 0;

      this.monitorForm.list.forEach((e) => {
        sz += parseFloat(
          this.$toFixed(parseFloat(e.order_num * e.order_price))
        );
      });
      return this.$toFixed(sz);
    },
    import_header() {
      return {
        "X-Token": this.token,
        Authorization: this.token,
      };
    },
  },

  data() {
    return {
      dialogVisible: false,
      upload_images,
      // 合并订单
      shield: false,
      list_sh: [],
      shield_type: "",
      selectArr_sh: [],
      listLoading: false,
      // 时间
      parseTime,
      exportMethod,
      // 验证
      rules,
      // 列表数据
      monitorForm: {
        form: {
          name_uid: "",
          uid: "",
          nickname: "",
          line_id: "",
          salesman_id: "",
          contact: "",
          mobile: "",
          address: "",
          send_time: "",
          send_time_id: 0,
          auto_merge_order: false,
          auto_split_order: false,
          remark: "",
          zid: null,
          sub_zid: null,
        },
        list: [],
      },
      order_price: "",
      goods_remark: "",
      goods_cycle_id: "",
      goods_pre_purchase_price: "",
      goods_pre_price: "",
      address: {
        address: {
          name: "",
          mobile: "",
          address: "",
          detail: "",
        },
        info: {},
        subAccount: [],
      },
      puzzleImg,
      info: { field: [] },
      credit_status: 0,
      overdue_status: 0,
      // 商品搜索
      formsp: {
        name: [],
        girard: null,
        num: "",
        value: "",
      },
      show: true,
      // 页面设置
      mainor_ex: false,
      display_sub_account: false,
      type: [],
      Header: orderAddHeader,
      // 复制订单
      mainor_co: false,
      input: "",
      list_co: [],
      // id
      id: parseInt(this.$route.params.id),
      uid: this.$route.query.uid,
      // 监听滚动
      searchBarFixed: false,
      // 返回
      beforeNext: false,
      lng_lat_form: {
        lng_lat: "",
        lng_lat_mars: "",
      },
      userlabel: false, //智能识别打开按钮
      // 确认回车disabled
      mainor_qr_disabled: true,
      activeName: "txtpage", //切换页面
      identify: "", //文字识别输入框
      txtcontent: true, //控制文本框显示隐藏
      textSearchHeader: true, //文字头部确认等按钮 默认开启 图片识别则关闭
      identifyList: {
        vague: {},
      }, //识别出来结果数据
      tabform: {
        tablist: [],
      },
      currentSort: "", //样式切换
      sort_order_down: true, //true 向下  false  向上
      import_params: {},
      upload_images_loading: false,
      target: {},
      loading: false,
    };
  },
  //   mounted() {
  //     this.handleScroll();
  //     window.addEventListener("scroll", this.handleScroll);
  //     this.myDate();
  //   },
  //   destroyed() {
  //     window.removeEventListener("scroll", this.handleScroll);
  //   },
  created() {
    this.order_base();
    // // 信息
    // if (this.id) {
    //   this.order_base()
    //     .then(() => {
    //       this.order_getOrderList(this.uid, this.id);
    //     })
    //     .catch(() => {});
    // } else {
    // }
  },
  //   beforeRouteLeave(to, from, next) {
  //     if (this.beforeNext) {
  //       setTimeout(() => {
  //         this.beforeNext = false;
  //         this.$confirm(
  //           "您已经有数据操作，离开页面系统不会保存您的操作，确定离开吗？",
  //           "提示",
  //           {
  //             confirmButtonText: "确定",
  //             cancelButtonText: "取消",
  //             type: "warning"
  //           }
  //         )
  //           .then(() => {
  //             // 正常跳转
  //             next();
  //           })
  //           .catch(() => {
  //             next(false);
  //           });
  //       }, 200);
  //     } else {
  //       next();
  //     }
  //   },
  methods: {
    showDialog(info) {
      this.target = info;
      this.monitorForm.form.send_time = parseTime(
        info.send_time,
        "{y}-{m}-{d}"
      );
      this.basicChange({ id: info.uid });
      this.dialogVisible = true;
    },
    // 排序操作
    handleSort() {
      this.sort_order_down = !this.sort_order_down;
      let data = Object.assign(
        {
          sign: Md5(
            objKeySort(Object.assign(apiUrl().name)) + apiUrl().appsecret
          ),
        },
        apiUrl().name,
        {
          order_add_goods_sort: this.sort_order_down ? 0 : 1,
        }
      );
      setting_company(data).then((res) => {
        if (res.errcode == 0) {
        } else {
          this.$message.error(res.errmsg);
        }
      });
    },
    //切换页面事件
    handleClick(tab, event) {},
    // 时间
    myDate() {
      var myDate = new Date();
      myDate.setDate(myDate.getDate() + 1);
      this.monitorForm.form.send_time = myDate
        .toLocaleDateString()
        .replace(/\//g, "-");
    },
    // 监听全选
    handleSelectionChange(val) {
      this.selectArr_sh = [];

      val.map((item) => {
        this.selectArr_sh.push({
          id: item.id,
        });
      });
    },
    // 监听滚动
    handleScroll() {
      let scrollTop =
        window.pageYOffset ||
        document.documentElement.scrollTop ||
        document.body.scrollTop;
      scrollTop + document.documentElement.clientHeight >
      document.getElementById("newConBox").offsetTop + 300
        ? (this.searchBarFixed = false)
        : (this.searchBarFixed = true);
    },
    basicChange(val) {
      this.monitorForm.form.uid = val.id;
      let data = Object.assign(
        {
          sign: Md5(
            objKeySort(
              Object.assign(apiUrl().name, {
                id: val.id,
              })
            ) + apiUrl().appsecret
          ),
        },
        apiUrl().name,
        {
          id: val.id,
        }
      );
      order_getMemberInfo(data).then((res) => {
        if (res.errcode == 0) {
          if (res.data.info.credit_status == 2) {
            this.$alert(
              "当前用户欠款额度已达停止下单比例，无法下单！",
              "提示",
              {
                confirmButtonText: "确定",
                callback: (action) => {
                  this.userClear();
                },
              }
            );
          } else {
            if (res.data.info.overdue_status == 2) {
              this.$alert(
                "当前用户账期已超过预设最高账期，无法下单！",
                "提示",
                {
                  confirmButtonText: "确定",
                  callback: (action) => {
                    this.userClear();
                  },
                }
              );
            }
          }
          this.credit_status = res.data.info.credit_status;
          this.overdue_status = res.data.info.overdue_status;
          this.monitorForm.list = [];
          //   let send_time_id = Object.keys(this.info.send_time);

          //   if (send_time_id.includes(String(res.data.info.send_time_id))) {
          //     this.monitorForm.form.send_time_id = parseInt(
          //       res.data.info.send_time_id
          //     );
          //   } else {
          //     this.monitorForm.form.send_time_id = 0;
          //   }
          this.monitorForm.form.send_time_id = this.target.send_time_id;
          this.monitorForm.form.nickname = res.data.subAccount[0].nickname;
          this.monitorForm.form.line_id = res.data.info.line_id;
          this.monitorForm.form.salesman_id = res.data.info.salesman_id;
          this.monitorForm.form.contact = res.data.address.name;
          this.monitorForm.form.mobile = res.data.address.mobile;
          this.monitorForm.form.address =
            res.data.address.address + res.data.address.detail;
          this.monitorForm.form.zid = null;
          this.monitorForm.form.sub_zid = null;
          res.data.subAccount.map((e, ind) => {
            if (ind == 0) {
              e.id = 0;
              e.nickname = "主账号";
            }
          });
          this.address = res.data;
          this.beforeNext = true;
          this.lng_lat_form.lng_lat =
            res.data.address.lng + "," + res.data.address.lat;
          this.lng_lat_form.lng_lat_mars =
            res.data.address.lng_mars + "," + res.data.address.lat_mars;
        } else {
          this.$message.error(res.errmsg);
        }
      });
    },
    // 子账号显示
    setting_company() {
      if (!this.display_sub_account) {
        this.userClear();
      }
      let data = Object.assign(
        {
          sign: Md5(
            objKeySort(
              Object.assign(apiUrl().name, {
                display_sub_account: this.display_sub_account ? 1 : 0,
              })
            ) + apiUrl().appsecret
          ),
        },
        apiUrl().name,
        {
          display_sub_account: this.display_sub_account ? 1 : 0,
        }
      );
      setting_company(data).then((res) => {
        if (res.errcode == 0) {
        } else {
          this.$message.error(res.errmsg);
        }
      });
    },
    sub_account(val) {
      this.monitorForm.form.zid = this.address.subAccount[val].id;
      this.address.address = this.address.subAccount[val].address;
      this.monitorForm.form.contact = this.address.subAccount[val].address.name;
      this.monitorForm.form.mobile =
        this.address.subAccount[val].address.mobile;
      this.monitorForm.form.address =
        this.address.subAccount[val].address.address +
        this.address.subAccount[val].address.detail;
    },
    // 合并订单
    checkboxGroup() {
      let data = Object.assign(
        {
          sign: Md5(
            objKeySort(
              Object.assign(apiUrl().name, {
                auto_merge_order: this.monitorForm.form.auto_merge_order
                  ? 1
                  : 0,
              })
            ) + apiUrl().appsecret
          ),
        },
        apiUrl().name,
        {
          auto_merge_order: this.monitorForm.form.auto_merge_order ? 1 : 0,
        }
      );
      setting_company(data).then((res) => {
        if (res.errcode == 0) {
        } else {
          this.$message.error(res.errmsg);
        }
      });
    },
    shield_sh(type) {
      if (this.selectArr_sh.length != 0) {
        let data = Object.assign(
          {
            sign: Md5(
              objKeySort(
                Object.assign(apiUrl().name, {
                  merge_status: type,
                })
              ) + apiUrl().appsecret
            ),
          },
          apiUrl().name,
          this.order_data().form,
          {
            list: JSON.stringify(this.order_data().list),
          },
          {
            ids: JSON.stringify(this.selectArr_sh),
            merge_status: type,
          }
        );

        order_add(data).then((res) => {
          this.shield = false;
          if (res.errcode == 0) {
            this.$message({
              message: "保存成功",
              type: "success",
            });
            if (this.shield_type == 1) {
              this.userClear();
            } else {
              this.$router.go(-1);
            }
          } else {
            this.$message.error(res.errmsg);
          }
        });
      } else {
        this.$message.error("请勾选商品");
      }
    },
    // 商品搜索
    querySearchAsync(queryString, cb) {
      //   if (this.monitorForm.form.name_uid == "") {
      //     this.$message.error("用户名称不能为空");
      //     this.$refs.company.focus();
      //     cb([]);
      //     return;
      //   }
      if (queryString.trim() == "") {
        cb([]);
        return;
      }
      let data = Object.assign(
        {
          sign: Md5(
            objKeySort(
              Object.assign(apiUrl().name, {
                name: queryString.trim(),
              })
            ) + apiUrl().appsecret
          ),
        },
        apiUrl().name,
        {
          name: queryString.trim(),
        }
      );
      goods_getAllGoodsSpu(data).then((res) => {
        if (res.errcode == 0) {
          res.data.goods.map((e) => {
            let title = e.spu_name ? e.spu_name.title : "";
            e.name = e.goods.name + "【" + title + "】";
          });
          var results = res.data.goods;
          if (this.$refs.searchSelect) {
            this.$refs.searchSelect.activated = true;
          }
          cb(results);
        } else {
          this.$message.error(res.errmsg);
          cb([]);
        }
      });
    },
    // 商品选择
    handleSelect(item) {
      this.formsp.name = item;
      this.formsp.girard = item.id;
      this.mainor_qr_disabled = true;
      this.goods_getOfferPrice();
      setTimeout(() => {
        this.$refs.focusw2.focus();
      }, 100);
    },
    goods_getOfferPrice() {
      let formsp = JSON.parse(JSON.stringify(this.formsp));
      let data = Object.assign(
        {
          sign: Md5(
            objKeySort(
              Object.assign(apiUrl().name, {
                uid: this.monitorForm.form.uid,
                group_id: this.address.info.id,
                goods_id: formsp.name.goods_id,
                goods_spu_id: formsp.girard,
              })
            ) + apiUrl().appsecret
          ),
        },
        apiUrl().name,
        {
          uid: this.monitorForm.form.uid,
          group_id: this.address.info.group_id,
          goods_id: formsp.name.goods_id,
          goods_spu_id: formsp.girard,
        }
      );
      goods_getOfferPrice(data).then((res) => {
        if (res.errcode == 0) {
          this.order_price = res.data.price;
          this.goods_remark = res.data.remark;
          this.goods_cycle_id = res.data.cycle_id;
          this.goods_pre_purchase_price = res.data.pre_purchase_price;
          this.goods_pre_price = res.data.pre_price;
          this.mainor_qr_disabled = false;
        } else {
          this.$message.error(res.errmsg);
        }
      });
    },
    // 商品选择确认(回车)
    mainor_sp(e) {
      var keyCode = window.event ? e.keyCode : e.which;
      if (keyCode == 13) {
        this.mainor_qr();
      }
    },
    // 点击添加
    mainor_qr() {
      let formsp = JSON.parse(JSON.stringify(this.formsp));
      if (!formsp.name.name) {
        this.$message.error("请填写商品名称");
        this.$refs.searchSelect.focus();
        return;
      } else if (formsp.num == "") {
        this.$message.error("请填写数量");
        this.$refs.focusw2.focus();
        return;
      } else if (!this.mainor_qr_disabled) {
        this.mainor_qr_disabled = true;
        let monitorForm_list = JSON.parse(
          JSON.stringify(this.monitorForm.list)
        );
        let ind = 0;
        let index = 0;
        if (monitorForm_list.length != 0) {
          monitorForm_list.map((e) => {
            if (e.goods_spu_id == formsp.girard) {
              ind = e.goods_spu_id;
              return;
            }
          });
          if (ind == 0) {
            this.handle(formsp);
          } else {
            setTimeout(() => {
              let order_num = this.monitorForm.list[index].order_num;
              this.monitorForm.list[index].order_num =
                parseFloat(order_num) + parseFloat(formsp.num);
              this.$refs["order_num" + ind][0].focus();
              this.reset();
              ind = 0;
            }, 100);
          }
        } else {
          this.handle(formsp);
        }
      }
    },

    handle(formsp) {
      let list = JSON.parse(JSON.stringify(shuju.list));
      list.list_index = this.monitorForm.list.length + 1;
      formsp.name.goods.images.map((e) => {
        if (e.main == 1) {
          list.url = this.avatar.domain + e.path;
          list.pic = e.path;
        }
      });
      list.pid = formsp.name.goods.pid;
      list.category_id = formsp.name.goods.category_id;
      list.name = formsp.name.goods.name;
      list.goods_id = formsp.name.goods_id;
      list.standard_goods_id = formsp.name.goods.standard_goods_id;
      list.byname =
        formsp.name.goods.use_byname == 1 ? formsp.name.goods.byname : "";
      list.order_price = this.order_price;
      list.goods_spu_id = formsp.name.id;
      list.standard_spu_id = formsp.name.standard_spu_id;
      list.standard_spu_code = formsp.name.standard_spu_code;
      list.spu_name = formsp.name.spu_name.title;
      list.unit = formsp.name.spu_unit.title;
      list.purchase_price = formsp.name.purchase_price;
      list.order_num = formsp.num;
      list.designated_inventory = formsp.name.designated_inventory;
      list.minimum = formsp.name.minimum;
      if (formsp.name.inventory) {
        list.num = formsp.name.inventory.num;
      } else {
        list.num = 0;
      }
      list.discount = formsp.name.discount;
      list.remark = this.goods_remark;
      list.cycle_id = String(this.goods_cycle_id);
      list.pre_purchase_price = this.goods_pre_purchase_price;
      list.pre_price = this.goods_pre_price;
      list.describe = formsp.name.describe;
      list.red = false;
      if (parseFloat(list.purchase_price) > parseFloat(list.order_price)) {
        list.red = true;
      }

      if (this.sort_order_down) {
        this.monitorForm.list.unshift(list);
      } else {
        this.monitorForm.list.push(list);
      }
      this.reset();
      setTimeout(() => {
        this.$refs.searchSelect.focus();
      }, 100);
    },

    reset() {
      this.formsp = JSON.parse(JSON.stringify(shuju.formsp));
      this.show = false;
      this.$nextTick(() => {
        this.show = true;
      });
    },
    // 删除
    scdelete(index) {
      this.monitorForm.list.splice(index, 1);
    },
    //文字识别数据删除
    tadelete(index) {
      this.tabform.tablist.splice(index, 1);
      if (this.tabform.tablist.length == 0) {
        this.currentSort = "";
      }
    },
    // 页面设置
    determine() {
      let arry = [];
      this.Header.map((e) => {
        this.type.map((p) => {
          if (e.id == p) {
            arry.push(e.id);
            return;
          }
        });
      });
      this.field_save(arry);
    },
    recovery() {
      // this.field_save([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]);
      this.field_save([1, 3, 5, 9, 11, 12, 13]);
    },
    field_save(arry) {
      let data = Object.assign(
        {
          sign: Md5(
            objKeySort(
              Object.assign(apiUrl().name, {
                type: 4,
              })
            ) + apiUrl().appsecret
          ),
        },
        apiUrl().name,
        {
          type: 4,
          fields: JSON.stringify(arry),
        }
        // [1,2,3,4,5,6,7,8,9,10,11]
      );
      field_save(data).then((res) => {
        if (res.errcode == 0) {
          this.$message({
            message: "设置成功",
            type: "success",
          });
          this.order_base();
          this.mainor_ex = false;
        } else {
          this.$message.error(res.errmsg);
        }
      });
    },
    // 复制订单
    mainor_copy() {
      if (this.monitorForm.form.name_uid == "") {
        this.$message.error("用户名称不能为空");
        this.$refs.company.focus();
        return;
      }
      this.mainor_co = true;
      this.order_copyList();
    },
    // 复制订单-搜索
    mainor_cob_s() {
      this.order_copyList();
    },
    // 复制订单-复制
    copy(uid, id) {
      this.mainor_co = false;
      this.order_getOrderList(uid, id);
    },
    // 保存
    preservation(type) {
      this.$refs["userListFrom"].validate((valid) => {
        if (valid) {
          if (this.monitorForm.list.length == 0) {
            this.$message.error("请至少添加一个商品");
            return;
          }
          let list = this.order_data().list;
          let arr = [];
          list.map((e) => {
            arr.push(e.pid);
          });
          let newarr = [...new Set(arr)];

          // 合并优先级>拆分
          if (
            !this.monitorForm.form.auto_merge_order &&
            this.monitorForm.form.auto_split_order &&
            newarr.length > 1
          ) {
            this.$confirm(
              `当前订单可按商品一级分类拆成${newarr.length}个订单，确定拆分吗？`,
              "提示",
              {
                confirmButtonText: "拆分",
                cancelButtonText: "不拆分",
                type: "warning",
              }
            )
              .then(() => {
                this.order_add(type);
              })
              .catch(() => {
                this.this.monitorForm.form.auto_split_order = false;
                this.order_add(type);
              });
          } else {
            this.order_add(type);
          }
        }
      });
    },
    //  保存到数据库
    order_add(type) {
      let data = Object.assign(
        {
          sign: Md5(
            objKeySort(Object.assign(apiUrl().name)) + apiUrl().appsecret
          ),
        },
        apiUrl().name,
        this.order_data().form,
        {
          list: JSON.stringify(this.order_data().list),
        },
        this.lng_lat_form
      );
      this.loading = true;
      order_add(data)
        .then((res) => {
          if (res.errcode == 0) {
            this.$message({
              message: "添加成功",
              type: "success",
            });
            this.dialogVisible = false;
            //   if (type == 1) {
            //     this.userClear();
            //   } else {
            //     this.$router.go(-1);
            //   }
          } else if (res.errcode == 40042) {
            this.shield_type = type;
            this.list_sh = res.list;
            this.shield = true;
          } else {
            this.$message.error(res.errmsg);
          }
        })
        .finally(() => {
          this.loading = false;
        });
    },
    order_data() {
      let { sub_zid, name_uid, ...form } = JSON.parse(
        JSON.stringify(this.monitorForm.form)
      );
      form.auto_merge_order = form.auto_merge_order ? 1 : 0;
      form.auto_split_order = form.auto_split_order ? 1 : 0;
      form.zid = form.zid ? form.zid : 0;
      let sz = JSON.parse(JSON.stringify(this.monitorForm.list));

      let list = sz.map((e) => {
        let {
          url,
          describe,
          show,
          num,
          designated_inventory,
          minimum,
          red,
          list_index,
          pre_purchase_price,
          pre_price,
          ...sz
        } = e;

        return { ...sz };
      });
      return {
        form,
        list,
      };
    },
    userClear() {
      this.credit_status = 0;
      this.overdue_status = 0;
      this.monitorForm.list = [];
      this.address = JSON.parse(JSON.stringify(shuju.address));
      this.monitorForm.form = JSON.parse(JSON.stringify(shuju.form));
      this.myDate();
    },
    // 信息
    order_base() {
      let data = Object.assign(
        {
          sign: Md5(
            objKeySort(Object.assign(apiUrl().name)) + apiUrl().appsecret
          ),
        },
        apiUrl().name
      );
      return new Promise((resolve, reject) => {
        order_base(data)
          .then((res) => {
            resolve();
            if (res.errcode == 0) {
              this.type = res.data.field;
              this.sort_order_down = !res.data.order_add_goods_sort
                ? true
                : false;
              this.monitorForm.form.auto_merge_order =
                res.data.auto_merge_order == 1 ? true : false;
              this.display_sub_account =
                res.data.display_sub_account == 1 ? true : false;
              this.info = res.data;
            } else {
              this.$message.error(res.errmsg);
            }
          })
          .catch((error) => {
            reject();
          });
      });
    },
    // 复制订单
    order_copyList() {
      let data = Object.assign(
        {
          sign: Md5(
            objKeySort(
              Object.assign(apiUrl().name, {
                uid: this.monitorForm.form.uid,
                order_sn: this.input,
              })
            ) + apiUrl().appsecret
          ),
        },
        apiUrl().name,
        {
          uid: this.monitorForm.form.uid,
          order_sn: this.input,
        }
      );
      order_copyList(data).then((res) => {
        if (res.errcode == 0) {
          this.list_co = res.data.list;
        } else {
          this.$message.error(res.errmsg);
        }
      });
    },
    order_getOrderList(uid, id) {
      let data = Object.assign(
        {
          sign: Md5(
            objKeySort(
              Object.assign(apiUrl().name, {
                uid: uid,
                id: id,
              })
            ) + apiUrl().appsecret
          ),
        },
        apiUrl().name,
        {
          uid: uid,
          id: id,
        }
      );
      order_getOrderList(data).then((res) => {
        if (res.errcode == 0) {
          this.monitorForm.form.name_uid = res.data.member.nickname;
          this.monitorForm.form.uid = res.data.member.id;
          this.monitorForm.form.nickname = res.data.address.name;
          this.monitorForm.form.line_id = res.data.info.line_id;
          this.monitorForm.form.salesman_id = res.data.info.salesman_id;
          this.monitorForm.form.contact = res.data.address.name;
          this.monitorForm.form.mobile = res.data.address.mobile;
          this.monitorForm.form.address =
            res.data.address.address + res.data.address.detail;
          // this.monitorForm.form.send_time_id = parseInt(
          //   res.data.info.send_time_id
          // );
          let send_time_keys = Object.keys(this.info.send_time);
          let flag = false;
          send_time_keys.map((e) => {
            if (e == this.monitorForm.form.send_time_id) {
              flag = true;
            }
          });
          flag
            ? (this.monitorForm.form.send_time_id = parseInt(
                res.data.info.send_time_id
              ))
            : (this.monitorForm.form.send_time_id = 0);
          this.monitorForm.form.zid = res.data.info.user_id;
          this.monitorForm.form.sub_zid = res.data.subAccount.findIndex((e) => {
            return e.id == res.data.info.user_id;
          });
          res.data.subAccount.map((e, ind) => {
            if (ind == 0) {
              e.id = 0;
              e.nickname = "主账号";
            }
          });
          this.address.address.name = res.data.address.name;
          this.address.address.mobile = res.data.address.mobile;
          this.address.address.address = res.data.address.address;
          this.address.address.detail = res.data.address.detail;
          this.address.subAccount = res.data.subAccount;
          this.address.info = res.data.info;
          this.standard(res.data.orderList);
        } else {
          this.$message.error(res.errmsg);
        }
      });
    },
    standard(data) {
      let arry = [];
      data.map((e, index) => {
        arry.push({
          list_index: index + 1,
          pre_price: e.pre_price,
          pre_purchase_price: e.pre_purchase_price,
          pid: e.pid,
          category_id: e.category_id,
          cycle_id: e.cycle_id,
          pic: e.pic,
          url: this.avatar.domain + e.pic,
          name: e.name,
          describe: e.describe,
          goods_id: e.goods_id,
          standard_goods_id: e.standard_goods_id,
          goods_spu_id: e.goods_spu_id,
          standard_spu_id: e.standard_spu_id,
          standard_spu_code: e.standard_spu_code,
          byname: e.byname,
          spu_name: e.spu_name,
          unit: e.unit,
          order_num: e.order_num,
          order_price: e.order_price,
          purchase_price: e.purchase_price,
          remark: e.remark,
          designated_inventory: e.goods_spu.designated_inventory,
          minimum: e.goods_spu.minimum,
          num: e.inventory ? e.inventory.num : "",
          discount: e.discount,
          show: true,
          red:
            parseFloat(e.purchase_price) > parseFloat(e.order_price)
              ? true
              : false,
        });
      });
      this.monitorForm.list = arry;
    },
    //文字识别接口
    text_identify() {
      let formsp = JSON.parse(JSON.stringify(this.formsp));
      let data = Object.assign(
        {
          sign: Md5(
            objKeySort(
              Object.assign(apiUrl().name, {
                uid: this.monitorForm.form.uid,
                group_id: this.address.info.group_id,
                contents: this.identify,
              })
            ) + apiUrl().appsecret
          ),
        },
        apiUrl().name,
        {
          uid: this.monitorForm.form.uid,
          group_id: this.address.info.group_id,
          contents: this.identify,
        }
      );
      text_identify(data).then((res) => {
        if (res.errcode == 100) {
          this.$message.error(res.errmsg);
          this.txtcontent = true;
        } else {
          this.identifyList = res.data;
          this.txtcontent = false;
          this.tabform.tablist = res.data.list;
        }
      });
    },

    // 智能识别
    smart(type) {
      switch (type) {
        case 1:
          let data = Object.assign(
            {
              sign: Md5(
                objKeySort(Object.assign(apiUrl().name)) + apiUrl().appsecret
              ),
            },
            apiUrl().name,
            { uid: this.monitorForm.form.uid }
          );
          this.import_params = data;
          if (this.monitorForm.form.name_uid == "") {
            this.$message.error("用户名称不能为空");
            this.$refs.company.focus();
            return;
          }
          this.userlabel = true;
          break;
        case 2:
          let symbol =
            /[`~!#$%^&*()_\+=<>?:"{}|~！#￥%&*（）={}|《》？：“”【】、‘’。、+]/g;
          if (this.identify == "" || symbol.test(this.identify)) {
            this.$message.error("不能输入特殊字符或内容为空");
          } else {
            this.text_identify();
          }
          break;
        case 3:
          this.smartHandleData();
          break;
        case 4:
          this.txtcontent = true;
          this.currentSort = "";
          break;
      }
    },
    // 智能识别格式化数据
    smartHandleData() {
      let list = JSON.parse(JSON.stringify(shuju.list));
      let arr = [];
      let old_list = JSON.parse(JSON.stringify(this.monitorForm.list));
      let length = old_list.length;
      this.tabform.tablist.map((e, index) => {
        arr.push({
          list_index: length + index + 1,
          pre_price: e.all.pre_price,
          pre_purchase_price: e.all.pre_purchase_price,
          pid: e.all.pid,
          category_id: e.all.category_id,
          pic: e.all.pic,
          url: this.avatar.domain + e.all.pic,
          name: e.all.name,
          describe: e.describe,
          goods_id: e.all.goods_id,
          standard_goods_id: e.all.standard_goods_id,
          goods_spu_id: e.all.goods_spu_id,
          standard_spu_id: e.all.standard_spu_id,
          standard_spu_code: e.all.standard_spu_code,
          byname: e.all.byname,
          spu_name: e.all.spu_name,
          unit: e.all.unit,
          order_num: e.order_num,
          order_price: e.order_price,
          purchase_price: e.all.purchase_price,
          remark: e.remark,
          designated_inventory: e.designated_inventory,
          minimum: e.minimum,
          num: e.inventory_num ? e.inventory_num : "",
          show: true,
          cycle_id: e.all.cycle_id,
          discount: e.all.discount,
          red:
            parseFloat(e.all.purchase_price) > parseFloat(e.order_price)
              ? true
              : false,
        });
      });

      this.monitorForm.list = arr.concat(old_list);
      this.userlabel = false;
      this.monitorForm.list.sort(compare("list_index"));
    },

    tabsecect(value, index, lindex) {
      let formsp = JSON.parse(JSON.stringify(this.formsp));
      let data = Object.assign(
        {
          sign: Md5(
            objKeySort(
              Object.assign(apiUrl().name, {
                uid: this.monitorForm.form.uid,
                group_id: this.address.info.group_id,
                contents: this.identify,
                spu_name_id: value.spu_name_id,
                goods_spu_id: value.id,
                contents: index,
              })
            ) + apiUrl().appsecret
          ),
        },
        apiUrl().name,
        {
          uid: this.monitorForm.form.uid,
          group_id: this.address.info.group_id,
          contents: this.identify,
          spu_name_id: value.spu_name_id,
          goods_spu_id: value.id,
          contents: index,
        }
      );
      vague_search(data).then((res) => {
        if (res.errcode == 100) {
          this.$message.error(res.errmsg);
        } else {
          let goodspu_id = res.data.list[0].all.goods_spu_id;
          let arr = this.tabform.tablist.map((e) => {
            return e.all.goods_spu_id;
          });
          if (!arr.includes(goodspu_id)) {
            this.currentSort = index + "/" + lindex;
            this.tabform.tablist.push(res.data.list[0]);
          } else {
            this.currentSort = index + "/" + lindex;
            this.$message.error("商品已经存在");
          }
        }
      });
    },

    drawerClose() {
      this.tabform.tablist = [];
      this.identifyList = [];
      this.txtcontent = true;
      this.textSearchHeader = true;
      this.identify = "";
    },

    // 图片识别
    downloadTemplate() {
      const end = new Date();
      const start = new Date();
      start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
      let data = {
        uid: this.monitorForm.form.uid,
        start_time: this.parseTime(start, "{y}-{m}-{d}"),
        end_time: this.parseTime(end, "{y}-{m}-{d}"),
      };
      const notify = this.$notify.info({
        title: "开始导出...",
        type: "success",
        duration: 0,
      });
      identity_export_template(data).then((res) => {
        this.exportMethod(res, "智能识别用户模板", notify);
      });
    },
    // 上传图片
    importerr(err, file, fileList) {
      this.$message.error("上传失败");
      this.upload_images_loading = false;
    },
    importSuccess(response, file, fileList) {
      if (response.errcode != 0) {
        this.$message.warning(response.errmsg);
      } else {
        this.activeName = "txtpage";
        this.$nextTick(() => {
          this.txtcontent = false;
          this.textSearchHeader = false;
          this.tabform.tablist = response.data;
        });
      }
      this.upload_images_loading = false;
    },
    beforeUpload(file) {
      let type = file.type;
      let typeList = ["image/jpeg", "image/jpg", "image/png"];
      let isType = false;
      typeList.forEach((e) => {
        if (e == type) {
          isType = true;
          return;
        }
      });
      const isLt2M = file.size / 1024 / 1024 < 2;
      if (!isType) {
        this.$message.error("请上传正确的图片格式");
      }
      if (!isLt2M) {
        this.$message.error("上传头像图片大小不能超过 2MB!");
      }

      this.upload_images_loading = false;
      return isType && isLt2M;
    },
  },
};
</script>
<style lang="scss" scoped>
@import "@/styles/variables.scss";
.mainsu {
  .mainor_form form {
    width: calc(100% - 180px);
  }
}
.main_name {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 5px 0;
  height: 50px;

  .main_addr {
    color: #999;
  }

  span {
    line-height: 20px;
    display: inline;
    height: 20px;
  }
}

/deep/.el-dialog__body {
  padding: 0;
}

.mainor {
  /deep/.el-button--default {
    border-color: $menuActiveText;
    color: $menuActiveText;
  }

  /deep/.el-form {
    margin-top: 10px;

    /deep/.el-form-item--mini.el-form-item,
    /deep/.el-form-item--small.el-form-item {
      margin-bottom: 10px;
    }
  }

  /deep/.el-drawer__header {
    text-align: center;
    margin: 0px 20px 0px 20px;
    color: #333;
    font-size: 18px;
    border-bottom: 1px solid rgb(226, 221, 221);
    padding: 20px;
  }

  .notes {
    margin-left: 80px;
    color: $colour_red;
    font-size: $font_12;
  }

  .mainor_copy {
    position: relative;
    top: -4px;
  }

  .remark_in {
    width: 100%;

    /deep/.el-form-item__content {
      width: 80%;

      .el-input {
        width: 66.9%;
      }
    }
  }

  .mainor_zh {
    padding-top: 5px;
    padding-bottom: 5px;

    em {
      color: $colour_18;
      font-size: $font_14;
      display: inline-block;
      width: 90px;
      text-align: right;
      margin-right: 9px;
    }

    span {
      color: $colour_18;
      font-size: $font_14;
      margin-right: 15px;
    }
  }

  .mainor_sp {
    ul {
      margin-right: 20px;

      li {
        margin-bottom: 10px;

        & > span {
          display: inline-block;
          line-height: 32px;
          width: 60px;
          color: $colour_18;
          font-size: $font_14;
          text-align: right;

          em {
            color: $colour_red;
            margin-right: 5px;
          }
        }

        &:first-child {
          & > span {
            width: 85px;
          }
        }
      }
    }
  }

  .newConBox.on {
    width: calc(100% - 230px);
    padding-left: 0;
  }

  .mainor_pr {
    margin-left: 10px;
    margin-bottom: 10px;

    /deep/.el-button--default {
      border-color: $subActive;
      color: $menuText;

      &:hover {
        border-color: $menuActiveText;
        color: $menuActiveText;
      }
    }

    .mainor_prr {
      font-size: $font_16;
      color: $colour_18;

      span {
        color: #fe3b3b;
        margin-left: 10px;
      }
    }
  }

  .mainor_ex {
    position: fixed;
    width: 220px;
    height: 100%;
    background: $white;
    box-shadow: 0 6px 10px rgba(0, 21, 41, 0.08);
    top: 0;
    right: 0;
    z-index: 9999;
    transition: all 0.5s;
    transform: translate3d(100%, 0, 0);

    &.on {
      transform: translate3d(0, 0, 0);
    }

    .mainor_exb {
      position: absolute;
      width: 100%;
      height: calc(100% - 60px);
      overflow-y: auto;

      h3 {
        font-size: $font_16;
        color: $colour_18;
        height: 50px;
        line-height: 50px;
        border-bottom: 1px solid $colour_e6;
        padding-left: 20px;
      }

      .mainor_exb_an {
        padding-left: 20px;
        margin-top: 15px;

        /deep/.el-checkbox {
          display: block;
          margin-top: 15px;
          margin-bottom: 15px;
        }
      }
    }

    .mainor_exb_b {
      position: absolute;
      bottom: 0;
      width: 100%;
      border-top: 1px solid $colour_e6;
      height: 55px;
      text-align: center;

      /deep/.el-button--default {
        margin-top: 12px;
        border-color: $subActive;
        color: $menuText;

        &:hover {
          border-color: $menuActiveText;
          color: $menuActiveText;
        }
      }
    }
  }

  .main_table {
    /deep/.el-table--small td {
      padding: 10px 0;
    }
  }

  .main_taf {
    /deep/.el-table--small td {
      padding-top: 0;
    }

    /deep/.el-form-item--small.el-form-item {
      margin-bottom: 16px;
      margin-top: 16px;
      margin-right: 0;
    }
  }

  .mainor_co {
    position: fixed;
    width: 460px;
    height: 100%;
    background: $white;
    box-shadow: 0 6px 10px rgba(0, 21, 41, 0.08);
    top: 0;
    right: 0;
    z-index: 9999;
    transition: all 0.5s;
    transform: translate3d(100%, 0, 0);

    /deep/.el-button--default {
      border: 0;
    }

    &.on {
      transform: translate3d(0, 0, 0);
    }

    .mainor_cob_c {
      position: absolute;
      top: 15px;
      right: 15px;

      i {
        font-size: 22px;
        font-weight: bold;
        color: $colour_6;
      }

      &:hover {
        cursor: pointer;
      }
    }

    .mainor_cob_s {
      margin-top: 50px;
      margin-left: 10px;
      margin-right: 10px;

      p {
        font-size: $font_12;
        color: $colour_red;
        margin-top: 10px;
      }

      /deep/.el-input-group {
        width: 100%;
      }
    }

    .main_table {
      margin-left: 0;
      position: fixed;
      top: 0;
      height: calc(100% - 120px);
      width: 100%;
      margin-top: 120px;

      /deep/.el-table__body-wrapper {
        border-left: 0;

        table {
          border-left: 1px solid #ebeef5;
        }
      }

      /deep/.el-table__fixed-body-wrapper {
        border-right: 0;

        table {
          border-right: 1px solid #ebeef5;
        }
      }

      .main_table_p {
        margin-left: 10px;
        margin-right: 10px;
        height: 100%;
      }

      /deep/.el-table th .cell {
        font-size: $font_14;
      }
    }
  }

  .main_dialog .main_table {
    /deep/.el-table__body-wrapper {
      overflow-y: auto;
      height: 360px;
    }
  }
}

.order_num_tips {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #999;
  font-size: 14px;
}
.top-box {
  display: flex;
  align-items: center;
  flex: 1;
}
.btn-all {
  display: flex;
  align-items: center;
}
.lf-m-l10 {
  margin-right: 10px;
}
/deep/.el-tabs__nav {
  display: flex !important;
  justify-content: space-around !important;
  float: none;
}
/deep/.el-tabs__nav-wrap::after {
  background-color: transparent !important;
}
/deep/.el-tabs__item.is-active {
  color: #27b096 !important;
  border-bottom: 1px solid #27b096;
}
/deep/.el-tabs__item:hover {
  color: #27b096 !important;
  border-bottom: 1px solid #27b096;
}
/deep/.el-tabs__active-bar {
  height: 0px;
}
/deep/.el-tabs__item {
  padding: 0px;
  border-bottom: 1px solid #6f6f6f;
  height: auto;
  line-height: normal;
  color: #333;
  font-size: 16px;
}

.top-txt {
  height: auto;
}
.rules {
  color: #6f6f6f;
  height: auto;
  line-height: 25px;
  font-size: 16px;
  margin-top: 15px;
}
.identify-box {
  display: flex;
  flex-direction: column;
  height: auto;
}
/deep/.el-textarea__inner {
  padding: 15px;
  height: 230px;
  color: #333;
  font-size: 16px;
  border-radius: 2px;
  resize: none;
}
.btn-bgc {
  width: 100px;
  background-color: #03a98e;
  color: white;
  text-align: center;
  float: right;
  padding: 8px 10px;
  border-radius: 3px;
  margin-top: 100px;
}
.lf-m-t20 {
  margin-top: 20px;
}
.content-hig {
  height: auto;
}

.identify-coulmn {
  display: flex;
  flex-direction: column;
  height: auto;
}

.identify-content {
  display: flex;
  flex-direction: row;
  height: auto;
  flex-wrap: wrap;
}
.identify span {
  height: 35px;
  line-height: 35px;
  color: #8e8e8e;
}
.identify-main {
  height: auto;
}

.identify-main span {
  height: 35px;
  line-height: 35px;
  color: #8e8e8e;
}
.content-result {
  display: flex;
  flex-direction: row;
  height: auto;
  color: #8e8e8e;
}
.content-result span {
  height: 35px;
  line-height: 35px;
  display: block;
  margin-top: 10px;
  min-width: 65px;
}
.resultbtn {
  min-width: 100px;
  text-align: center;
  border-radius: 3px;
  height: 35px;
  margin: 10px 0px 0px 10px;
}

.activebtn {
  background-color: #03a98e;
  color: white !important;
}

.content-left {
  display: flex;
  flex-direction: row;
  align-items: center;
}

.btn-right {
  height: auto;
}

.right-btn {
  width: 100px;
  text-align: center;
  padding: 8px;
  border-radius: 3px;
  background-color: #03a98e;
  color: white;
}

.lf-m-10 {
  margin-left: 10px;
}
.green-txt {
  color: #03a98e !important;
}
.red-txt {
  color: #fe3b3b !important;
}
.table-width {
  width: 100%;
  overflow-x: auto;
}

.lf-m-t10 {
  margin-top: 10px;
}

.flex1 {
  flex: 1;
}

.goods-txt {
  height: 35px;
  line-height: 35px;
  color: #8e8e8e;
}

/deep/.el-table--small td {
  padding-top: 10px !important;
}
.new_navbar_svg {
  transform: rotate(180deg);
  transition: all 500ms ease;
}
.new_navbar_svg2 {
  transition: all 500ms ease;
}

.svg_box {
  display: flex;
  align-items: center;
  margin-left: 15px;
  .navbar_svg {
    margin-left: 8px;
  }
}

// 图片识别
.imageIdentify {
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  .download_btn {
    background-color: #fff;
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    width: 360px;
    height: 180px;
    text-align: center;
    position: relative;
    overflow: hidden;
    div {
      display: flex;
      flex-direction: column;
      cursor: pointer;
      color: #606266;
      font-size: 14px;
    }
    &:hover {
      border-color: #409eff;
    }
    .el-icon-download {
      font-size: 60px;
      margin: 40px 0 16px 0;
      line-height: 50px;
      color: #c0c4cc;
    }
  }
  .download_btn_tips {
    width: 360px;
    font-size: 12px;
    color: #606266;
    margin-top: 8px;
    line-height: 1.5;
  }
}
.upload_box {
  background-color: #fff;
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  width: 360px;
  height: 180px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
</style>
